/*
 This file 'zdwxy_1' is part of Firebird Integrated Solution 1.0

 Copyright (c) 2020 Lincong

 Contact:  
        Email: lincong1987@gmail.com

        QQ: 159257119
 
 See Usage at http://www.jplatformx.com/firebird

 Create date: 2020-06-14 20:49
 */

define(function (require, exports, module) {

	require("../model/Chart");

	var ArrayUtils = require("../assets/ArrayUtils");

	var id = "zdwxy_6";

	Firebird.define(id, {
		extend: "Chart",
		setValue: function (data) {

			this.data = data = [
				{
					online: 1,
					offline: 1,
					date: "2020/01/06"
				}, {
					online: 2,
					offline: 2,
					date: "2020/01/02"
				}, {
					online: 3,
					offline: 3,
					date: "2020/01/03"
				}, {
					online: 4,
					offline: 4,
					date: "2020/01/04"
				}, {
					online: 5,
					offline: 5,
					date: "2020/01/05"
				}, {
					online: 6,
					offline: 6,
					date: "2020/01/06"
				}, {
					online: 7,
					offline: 7,
					date: "2020/01/07"
				}, {
					online: 3,
					offline: 5,
					date: "2020/01/08"
				}, {
					online: 9,
					offline: 9,
					date: "2020/01/09"
				}, {
					online: 10,
					offline: 10,
					date: "2020/01/10"
				}, {
					online: 11,
					offline: 11,
					date: "2020/01/11"
				}, {
					online: 12,
					offline: 12,
					date: "2020/01/12"
				}
			]

			var option = {
				textStyle: {},
				grid: {
					top: 30,
					left: 65,
					right: 65,
					bottom: 50
				},


				tooltip: {
					trigger: 'axis',
					axisPointer: {
						type: 'shadow',
						label: {
							show: true,
							backgroundColor: '#333'
						}
					}
				},
				legend: {
					show: true,
					top: 0,
					textStyle: {
						color: "#fff"
					},
				},
				xAxis: [
					{
						type: 'category',
						boundaryGap: false,
						axisLabel: {

							color: "#fff"
						},
						axisLabel: {
							fontSize: 16,
							color: '#fff'
						},
						data: data.map(function (node) {
							return node.date
						})
					}
				],
				yAxis: [
					{
						type: 'value',
						axisLabel: {
							fontSize: 16,
							color: '#fff'
						},
						axisLine: {
							show: true,
							lineStyle: {
								color: 'rgba(2, 234, 252, 1)'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								color: 'rgba(2, 234, 252, 1)'
							}
						}
					}
				],
				series: [
					{
						name: '在线',
						type: 'line',
						label: {
							normal: {
								show: false,
								position: 'top'
							}
						},
						itemStyle: {
							normal: {
								color: 'rgba(50, 197, 255, 1)',
								areaStyle: {
									color: Chart.linearGradient("rgba(50, 197, 255, 0.4)", "rgba(50, 197, 255, 0)")
								}
							}
						},
						data: data.map(function (node) {
							return node.offline
						})
					}, {
						name: '离线',
						type: 'line',
						label: {
							normal: {
								show: true,
								position: 'top'
							}
						},
						itemStyle: {
							normal: {
								color: 'rgba(0, 212, 116, 1)',
								areaStyle: {
									//color: '#94C9EC'
									color: Chart.linearGradient("rgba(0, 212, 116, 0.4)", "rgba(0, 212, 116, 0)")
								}
							}
						},
						data: data.map(function (node) {
							return node.online
						})
					}
				]
			};

			this.clear();
			this.setOption(option, !0);
		},
	});

	module.exports = Firebird.create(id, {id: id});
});